// 健康档案接口，内含有各种记录的接口
import axios from "axios";

// 1.对于BasicInfo.vue
// 获取基本信息，健康指标（带历史版本）
export const getBasicInfo = (userId) => axios.get(`/api/healthRecord/getHealthIndicators/${userId}`).then(res => {
  console.log('基本信息 接口原始响应:', res);
  return res;
})

// 2.MedicalHistory.vue
// 获取既往病史（带历史记录）
export const getMedicalHistory = (userId) => axios.get(`/api/healthRecord/getPastMedicalHistory/${userId}`).then(res => {
  console.log('既往病史 接口原始响应:', res);
  return res;
})

// 3.
// 获取家族病史
export const getFamilyHistory = (userId) => axios.get(`/api/healthRecord/getFamilyHistory/${userId}`).then(res => {
  console.log('家族病史 接口原始响应:', res);
  return res;
})

//4.
// 获取用药记录
export const getMedication = (userId) => axios.get(`/api/healthRecord/getMedicationRecord/${userId}`).then(res => {
  console.log('用药记录 接口原始响应:', res);
  return res;
})

//5.
// 获取体检报告
export const getCheckupReports = (userId) => axios.get(`/api/healthRecord/getMedicalExamReport/${userId}`).then(res => {
  console.log('体检报告 接口原始响应:', res);
  return res;
})

//6.
//过敏史
export const getAllergyHistory = (userId) => axios.get(`/api/healthRecord/getAllergyHistory/${userId}`).then(res => {
  console.log('过敏史 接口原始响应:', res);
  return res;
})

//7.通用接口：

//增加
export const createHealthRecord = (userId, data) => axios.post(`/api/healthRecord/addHealthRecord/${userId}`, data)

//更新
export const updateHealthRecord = (data) => axios.put(`/api/healthRecord/updateHealthRecord`, data)

//删除
export const deleteHealthRecord = (recordId) => axios.delete(`/api/healthRecord/deleteHealthRecord/${recordId}`)



